import tensorflow as tf

g1 = tf.Graph()
with g1.as_default():
    value = tf.get_variable("v", initializer=tf.zeros_initializer()(shape=[1]))

g2 = tf.Graph()
with g2.as_default():
    with g2.device("/gpu:0"):
        value = tf.get_variable("v", initializer=tf.ones_initializer()(shape=[1]))
        print(value)

with tf.Session(graph=g1) as session:
    tf.global_variables_initializer().run()
    with tf.variable_scope("", reuse=True):
        print(session.run(tf.get_variable("v")))

with tf.Session(graph=g2) as session:
    tf.global_variables_initializer().run()
    with tf.variable_scope("", reuse=True):
        print(value.eval())
